Introduce a pool-indexer to provide univ3 liquidity#4349
Open
Conversation
- Split `api/uniswap_v3.rs` into `pools.rs` and `ticks.rs` submodules
with shared helpers (`internal_error`, `parse_hex_address`) in `mod.rs`
- Add `{network}` path segment to routes; handlers return 404 for unknown networks
- Add `token0`/`token1` query params for symbol-based pool search
(partial, case-insensitive, order-independent for pairs)
- Extract `search_pools` and `list_pools` as focused internal helpers
- Document all public structs, fields, and handlers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts: # Cargo.lock # contracts/generated/contracts-facade/Cargo.toml # contracts/generated/contracts-facade/src/lib.rs # contracts/src/main.rs
|
Reminder: Please update the DB Readme and comment whether migrations are reversible (include rollback scripts if applicable).
Caused by: |
Contributor
|
Is there a way to split this PR into multiple parts and move with smaller iterations? |
Contributor
Author
I am open to ideas. |
squadgazzz
reviewed
Apr 28, 2026
squadgazzz
reviewed
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduces pool-indexer service that indexes Uniswap V3 pool state from on-chain events and serves it over HTTP, plus the driver-side plumbing to use it as a drop-in replacement for the Uniswap V3 subgraph. The goal is to remove the driver's request-path dependency on external subgraphs.
How it works at a high level. Pool-indexer maintains a Postgres snapshot of every Uniswap V3 pool on the factories it's configured to watch. The lifecycle is:
writers filter unknown pools out instead). Within a single chunk transaction: new pools are inserted, Swap/Initialize events update pool state (they contain sqrtPrice/liquidity/tick in the event payload — free state), Mint/Burn adjust tick liquidity_net and trigger a pool.liquidity() refresh if no Swap was
seen in the same chunk, and the checkpoint advances.
pass.
Driver integration. Behind a new V3PoolDataSource trait, the existing UniV3SubgraphClient and a new PoolIndexerClient are interchangeable. Config grows an optional pool-indexer-url; when set, it's used instead of the subgraph. The rest of the driver's V3 machinery (checkpoint, event replay, merge on new
blocks) is unchanged — pool-indexer just plugs in as the source of truth for initial + on-demand pool snapshots. Per-network switchover is one config line, fully backward compatible.
How to test
Added E2E tests.
I also deployed this to mainnet staging and did a swap and baseline participated. I did a bunch of smoke test that compare the results to the subgraph results and they were identical.